package com.tuzhi.sys.jpa.repository;

import com.tuzhi.base.jpa.repository.BaseRepo;
import com.tuzhi.sys.jpa.entity.SysMenuEntity;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SysMenuRepo extends BaseRepo<SysMenuEntity, Long> {
    /**
     * 根据权限标识找到菜单
     *
     * @param perms
     * @return
     */
    SysMenuEntity findByPerms(String perms);

    /**
     * 根据URL地址找到菜单
     *
     * @param url URL地址
     * @return
     */
    SysMenuEntity findByUrl(String url);

    @Query("select perms from SysMenuEntity")
    List<String> loadAllPerms();

    @Query("select url from SysMenuEntity")
    List<String> loadAllUrls();
}
